<?php
	$old_user = "";
	$skn = "";
	$msg = "";
	$error = "";

    if (isset($_REQUEST['user_name']) && 
        $_REQUEST['user_name'] != "") 
    {

        global $db_manager;
        $old_user = $_REQUEST['user_name'];
        
        $xactius = new x_actius($db_manager);
        
        $i = $xactius->delete_actiu($old_user);
        if ($i > 0) {
            $msg = $labels["LBL_USR_DELETED"];
            $skn = "showmessage";
            //Firewall rules should be restarted
            $xadmin = new x_admin($db_manager);
            $xadmin->set_reboot_mark();
            // Log action
            $xlog = new x_log($db_manager);
            $xlog->add_msg(sprintf($log_msg["LOG_MSG_DELUSR"], $old_user));
        } elseif ($i == 0) {
            $msg = $labels["LBL_USR_NOTFOUND"];
            $skn = "deluser";           
        } else {
            $msg = $db_manager->db_error();
            $skn = "deluser";           
        }
        
    } else {
        $skn = "deluser";
        $msg = "";
    }

    $Skinner=new Skinner();
    $Skinner->setSkin($skins_path.$skn);
    $Skinner->registerVariable("files_path", $files_path);
    $Skinner->registerVariable("admin_root", $admin_root);    
    $Skinner->registerVariable("message", $msg);
    $Skinner->registerVariable("user_name_value", $old_user);
    $Skinner->registerVariable("lbl_del_usr", $labels["LBL_DEL_USR"]);
    $Skinner->registerVariable("lbl_username", $labels["LBL_USER"]);
    $Skinner->registerVariable("lbl_ok", $labels["LBL_OK"]);
    
    $content=$Skinner->doSubstitution_FAST();
?>